<?php
header("Content-Type: text/plain");
$id = isset($_GET['id'])?$_GET['id']:'cctv1';
$n = [
   //央视
   'cctv1' => 'CCTV1SD_1200', //CCTV1综合
   'cctv1hd' => 'CCTV1HD_6000', //CCTV1综合HD
   'cctv1hd2' => 'CCTV1HDPortal_1500', //CCTV1综合HD2
   'cctv2' => 'CCTV2SD_1200', //CCTV2财*
   'cctv2hd' => 'CCTV2HD_6000', //CCTV2财*HD
   'cctv3' => 'CCTV3SD_1200', //CCTV3综艺
   'cctv3hd' => 'CCTV3HD_6000', //CCTV3综艺HD
   'cctv4' => 'CCTV4SD_1200', //CCTV4中文国际
   'cctv4hd' => 'CCTV4HD_6000', //CCTV4中文国际HD
   'cctv5' => 'CCTV5SD_1200', //CCTV5体育
   'cctv5hd' => 'CCTV5HD_6000', //CCTV5体育HD
   'cctv5p' => 'CCTV5plusSD_1200', //CCTV5+体育赛事
   'cctv5phd' => 'CCTV5plusHD_6000', //CCTV5+体育赛事
   'cctv6' => 'CCTV6SD_1200', //CCTV6电影
   'cctv6hd' => 'CCTV6HD_6000', //CCTV6电影HD
   'cctv7' => 'CCTV7SD_1200', //CCTV7国防军事
   'cctv7hd' => 'CCTV7HD_6000', //CCTV7国防军事HD
   'cctv8' => 'CCTV8SD_1200', //CCTV8电视剧
   'cctv8hd' => 'CCTV8HD_6000', //CCTV8电视剧HD
   'cctv9' => 'CCTV9SD_1200', //CCTV9纪录
   'cctv9hd' => 'CCTV9HD_6000', //CCTV9纪录HD
   'cctv10' => 'CCTV10SD_1200', //CCTV10科教
   'cctv10hd' => 'CCTV10HD_6000', //CCTV10科教HD
   'cctv11' => 'CCTV11SD_800', //CCTV11戏曲
   'cctv11b' => 'CCTV11HD_2000', //CCTV11戏曲2
   'cctv12' => 'CCTV12SD_1200', //CCTV12社会与法
   'cctv12hd' => 'CCTV12HD_6000', //CCTV12社会与法HD
   'cctv13' => 'CCTV13SD_800', //CCTV13新闻
   'cctv13b' => 'CCTV13HD_2000', //CCTV13新闻2
   'cctv14' => 'CCTV14SD_1200', //CCTV14少儿
   'cctv14hd' => 'CCTV14HD_6000', //CCTV14少儿HD
   'cctv15' => 'CCTVmusicSD_800', //CCTV15音乐
   'cctv15b' => 'CCTVmusicHD_2000', //CCTV15音乐2
   'cctv16' => 'CCTV16SD_1200', //CCTV16奥林匹克
   'cctv16hd' => 'CCTV16HD_6000', //CCTV16奥林匹克HD
   'cctv17' => 'CCTV17SD_1200', //CCTV17农业农村
   'cctv17hd' => 'CCTV17HD_6000', //CCTV17农业农村HD
   'fxzl' => 'FaXianZhiLvSD_800', //种养新影-发现之旅
   'fxzl2' => 'FaXianZhiLvHD_2000', //种养新影-发现之旅2
   'lgs' => 'LaoGuShiSD_800', //种养新影-老故事
   'lgs2' => 'LaoGuShiHD_2000', //种养新影-老故事2
   'yggw' => 'YangShiGouWuSD_800', //CCTV央广购物
   'yggw2' => 'YangShiGouWuHD_2000', //CCTV央广购物2
   'zsgw' => 'ZhongShiGouWuSD_800', //CCTV中视购物
   'zsgw2' => 'ZhongShiGouWuHD_2000', //CCTV中视购物2
   'cgtn' => 'CCTVnewsSD_800', //CGTN
   'cgtn2' => 'CCTVnewsHD_2000', //CGTN2
   'sh' => 'ShuHuaPinDaoSD_800', //书画频道
   'sh2' => 'ShuHuaPinDaoHD_2000', //书画频道2
   'zgtq' => 'ChinaQiXiangPinDaoSD_800', //中国天气
   'zgtq2' => 'ChinaQiXiangPinDaoHD_2000', //中国天气2
   //中国教育电视台
   'cetv1' => 'CETV1SD_1200', //CETV1中教1台
   'cetv1hd' => 'CETV1HD_6000', //CETV1中教1台HD
   'cetv3' => 'CETV3SD_800', //CETV3中教3台
   'cetv3b' => 'CETV3HD_2000', //CETV3中教3台2
   'cetv4' => 'CETV4SD_800', //CETV4中教4台
   'cetv4b' => 'CETV4HD_2000', //CETV4中教4台2
   'zqjy' => 'ZaoQiJiaoYuSD_800', //CETV早期教育
   'zqjy2' => 'ZaoQiJiaoYuHD_2000', //CETV早期教育2
   //CHC系列
   'chcgq' => 'CHCSD2_1200', //CHC高清电影
   'chcgqhd' => 'CHCHD2_6000', //CHC高清电影HD
   'chcdz' => 'MotionSD_800', //CHC动作电影
   'chcdz2' => 'MotionHD_2000', //CHC动作电影2
   'chcjt' => 'CHCSD_800', //CHC家庭影院
   'chcjt2' => 'CHCHD_2000', //CHC家庭影院2
   //卫视
   'bjws' => 'BTV1SD_1200', //北京卫视
   'bjhd' => 'BTV1HD_6000', //北京卫视HD
   'bjhd2' => 'BTV1HDPortal_1500', //北京卫视HD
   'dfws' => 'DongFangSD_1200', //东方卫视
   'dfhd' => 'DongFangHD_6000', //东方卫视HD
   'tjws' => 'TianJinSD_1200', //天津卫视
   'tjhd' => 'TianJinHD_6000', //天津卫视HD
   'cqws' => 'ChongQingSD_1200', //重庆卫视
   'cqhd' => 'ChongQingHD_6000', //重庆卫视HD
   'hljws' => 'HeiLongJiangSD_1200', //黑龙江卫视
   'hljhd' => 'HeiLongJiangHD_6000', //黑龙江卫视HD
   'jlws' => 'JiLinWeiShiSD_1200', //吉林卫视
   'jlhd' => 'JiLinWeiShiHD_6000', //吉林卫视HD
   'lnws' => 'LiaoNingSD_1200', //辽宁卫视
   'lnhd' => 'LiaoNingHD_6000', //辽宁卫视HD
   'nmws' => 'NeiMengGuSD_800', //内蒙古卫视
   'nmws2' => 'NeiMengGuHD_2000', //内蒙古卫视2
   'nxws' => 'NingXiaSD_800', //宁夏卫视
   'nxws2' => 'NingXiaHD_2000', //宁夏卫视2
   'gsws' => 'GanSuSD_800', //甘肃卫视
   'gsws2' => 'GanSuHD_2000', //甘肃卫视2
   'qhws' => 'QingHaiSD_800', //青海卫视
   'qhws2' => 'QingHaiHD_2000', //青海卫视2
   'sxws' => 'ShannXiSD_800', //陕西卫视
   'sxws2' => 'ShannXiHD_2000', //陕西卫视2
   'hbws' => 'HeBeiSD_1200', //河北卫视
   'hbhd' => 'HeBeiHD_6000', //河北卫视HD
   'sxiws' => 'ShanXiSD_800', //山西卫视
   'sxiws2' => 'ShanXiHD_2000', //山西卫视2
   'sdws' => 'ShanDongSD_1200', //山东卫视
   'sdhd' => 'ShanDongHD_6000', //山东卫视HD
   'ahws' => 'AnHuiSD_1200', //安徽卫视
   'ahhd' => 'AnHuiHD_6000', //安徽卫视HD
   'hnws' => 'HeNanSD_1200', //河南卫视
   'hnhd' => 'HeNanHD__6000', //河南卫视HD
   'hubws' => 'HuBeiSD_1200', //湖北卫视
   'hubhd' => 'HuBeiHD_6000', //湖北卫视HD
   'hunws' => 'HuNanSD_1200', //湖南卫视
   'hunhd' => 'HuNanHD_6000', //湖南卫视HD
   'jxws' => 'JiangXiSD_1200', //江西卫视
   'jxhd' => 'JiangXiHD_6000', //江西卫视HD
   'jsws' => 'JiangSuSD_1200', //江苏卫视
   'jshd' => 'JiangSuHD_6000', //江苏卫视HD
   'zjws' => 'ZheJiangSD_1200', //浙江卫视
   'zjhd' => 'ZheJiangHD_6000', //浙江卫视HD
   'dnws' => 'FuJianSD_1200', //东南卫视
   'dnhd' => 'FuJianHD_6000', //东南卫视HD
   'xmws' => 'XiaMenSD_800', //厦门卫视
   'xmws2' => 'XiaMenHD_2000', //厦门卫视2
   'gdws' => 'GuangDongSD_1200', //广东卫视
   'gdhd' => 'GuangDongHD_6000', //广东卫视HD
   'szws' => 'ShenZhenSD_1200', //深圳卫视
   'szhd' => 'ShenZhenHD_6000', //深圳卫视HD
   'gxws' => 'GuangXiSD_1200', //广西卫视
   'gxhd' => 'GuangXiHD_6000', //广西卫视HD
   'ynws' => 'YunNanSD_800', //云南卫视
   'ynws2' => 'YunNanHD_2000', //云南卫视2
   'gzws' => 'GuiZhouSD_800', //贵州卫视
   'gzws2' => 'GuiZhouHD_2000', //贵州卫视2
   'scws' => 'SiChuanSD_1200', //四川卫视
   'schd' => 'SiChuanHD_6000', //四川卫视HD
   'xjws' => 'XinJiangSD_800', //新疆卫视
   'xjws2' => 'XinJiangHD_2000', //新疆卫视2
   'btws' => 'BTTVSD_800', //兵团卫视
   'btws2' => 'BTTVHD_2000', //兵团卫视2
   'xzws' => 'XiZangSD_800', //西藏卫视
   'xzws2' => 'XiZangHD_2000', //西藏卫视2
   'hinws' => 'LvYouWeiShiSD_1200', //海南卫视
   'hinhd' => 'LvYouWeiShiHD_6000', //海南卫视HD
   'ssws' => 'SanShaSD_800', //三沙卫视
   'ssws2' => 'SanShaHD_2000', //三沙卫视2
   //北京
   'bjwy' => 'BTVwenyiSD_1200', //北京文艺HD
   'bjwyhd' => 'BTVwenyiHD_6000', //北京文艺HD
   'bjjskj' => 'BTV3SD_800', //北京纪实科教
   'bjjskj2' => 'BTV3HD_2000', //北京纪实科教2
   'bjys' => 'BTV4SD_1200', //北京影视
   'bjyshd' => 'BTV4HD_6000', //北京影视HD
   'bjcj' => 'BTV5SD_800', //北京财*
   'bjcj2' => 'BTV5HD_2000', //北京财*2
   'bjtyxx' => 'BTVjishiSD_1200', //北京体育休闲
   'bjtyxxhd' => 'BTVjishiHD_6000', //北京体育休闲HD
   'bjsh' => 'BTV7SD_800', //北京生活
   'bjsh2' => 'BTV7HD_2000', //北京生活2
   'bjqn' => 'BTV8SD_800', //北京青年
   'bjq2' => 'BTV8HD_2000', //北京青年2
   'bjxw' => 'BTV9SD_1200', //北京新闻
   'bjxw2' => 'BTVxinwenSD_1200', //北京新闻2
   'bjxwhd' => 'BTV9HD_6000', //北京新闻HD
   'bjxwhd2' => 'BTVxinwenHD_6000', //北京新闻HD2
   'bjkk' => 'BTV10SD_800', //北京卡酷
   'bjkk2' => 'BTV10HD_2000', //北京卡酷2
   'shdy' => 'SiHaiDiaoYuSD_800', //四海钓鱼
   'shdy2' => 'SiHaiDiaoYuHD_2000', //四海钓鱼2
   'jsjc' => 'JinShiJuChangSD_800', //京视剧场
   'jsjc2' => 'JinShiJuChangHD_2000', //京视剧场2
   'ytcq' => 'YiTanChunQiuSD_800', //弈坛春秋
   'ytcq2' => 'YiTanChunQiuHD_2000', //弈坛春秋2
   'hqqg' => 'HuanQiuQiGuanSD_800', //环球奇观
   'hqqg2' => 'HuanQiuQiGuanHD_2000', //环球奇观2
   'hqly' => 'HuanQiuLvYouSD_800', //环球旅游
   'hqly2' => 'HuanQiuLvYouHD_2000', //环球旅游2
   'yybb' => 'YouYouBaoBeiSD_800', //优优宝贝
   'yybb2' => 'YouYouBaoBeiHD_2000', //优优宝贝2
   'sthj' => 'XinYuLeSD_800', //生态环境
   'sthj2' => 'XinYuLeHD_2000', //生态环境2
   'zypd' => 'ZhiYePinDaoSD_800', //置业频道
   'zypd2' => 'ZhiYePinDaoHD_2000', //置业频道2
   'zhtc' => 'KaoShiZaiXianSD_800', //中华特产
   'zhtc2' => 'KaoShiZaiXianHD_2000', //中华特产2
   'jshqjx' => 'GHSSD_1200', //聚鲨环球精选
   'jshqjxhd' => 'GHSHD_6000', //聚鲨环球精选HD
   'ghds' => 'GeHuadaoshiSD_1200', //歌华导视
   'ghdshd' => 'GeHuadaoshiHD_6000', //歌华导视HD
   'ghdshd2' => 'GehuadaoshiHDPortal_1500', //歌华导视HD2
   'dgyy' => 'DongGanYinYueSD_800', //动感音乐
   'dgyy2' => 'DongGanYinYueHD_2000', //动感音乐2
   'pgxw' => 'PingGuQuXianXinWenSD_800', //平谷新闻
   'pgxw2' => 'PingGuQuXianXinWenHD_2000', //平谷新闻2
   'mtgxw' => 'MenTouGouQuXianXinWenSD_800', //门头沟新闻
   'mtgxw2' => 'MenTouGouQuXianXinWenHD_2000', //门头沟新闻2
   //上海
   'jsrw' => 'ShangHaiJiShiSD_1200', //上海纪实人文
   'jsrwhd' => 'ShangHaiJiShiHD_6000', //上海纪实人文HD
   'shss' => 'ShengHuoShiShangSD_1200', //生活时尚
   'shss2' => 'ShengHuoShiShangHD_6000', //生活时尚2
   'dsjc' => 'DuShiJuChangSD_1200', //都市剧场
   'dsjc2' => 'DuShiJuChangHD_6000', //都市剧场2
   'jsxt' => 'JinSePinDaoSD_800', //金色学堂
   'jsxt2' => 'JinSePinDaoHD_2000', //金色学堂2
   'dmxc' => 'DongManXiuChangSD_1200', //动漫秀场
   'dmxc2' => 'DongManXiuChangHD_6000', //动漫秀场2
   'cmpd' => 'QiChePinDaoSD_800', //车迷频道
   'cmpd2' => 'QiChePinDaoHD_2000', //车迷频道2
   'fztd' => 'FaZhiTianDiSD_800', //法治天地
   'fztd2' => 'FaZhiTianDiHD_2000', //法治天地2
   'mlzq' => 'MeiLiYinYueSD_1200', //魅力足球
   'mlzq2' => 'MeiLiYinYueHD_6000', //魅力足球2
   'ly' => 'QuanJiShiSD_1200', //乐游
   'ly2' => 'QuanJiShiHD_6000', //乐游2
   'jbty' => 'JinBaoTiYuSD_1200', //劲爆体育
   'jbty2' => 'JinBaoTiYuHD_6000', //劲爆体育2
   'yxfy' => 'YouXiFengYunSD_1200', //游戏风云
   'yxfy2' => 'YouXiFengYunHD_6000', //游戏风云2
   //重庆
   'ssgw' => 'ShiShangGouWuSD_800', //时尚购物
   'ssgw2' => 'ShiShangGouWuHD_2000', //时尚购物2
   //吉林
   'jygw' => 'JiaYouGouWuSD_800', //家有购物
   'jygw2' => 'JiaYouGouWuHD_2000', //家有购物2
   //辽宁
   'jtlc' => 'JiaTinLiCaiSD_800', //家庭理财
   'jtlc2' => 'JiaTinLiCaiHD_2000', //家庭理财2
   //山西
   'ygw' => 'YouGouWuSD_800', //优购物
   'ygw2' => 'YouGouWuHD_2000', //优购物2
   //山东
   'sdjy' => 'CETVSD_800', //山东教育卫视
   'sdjy2' => 'CETVHD_2000', //山东教育卫视2
   'sctx' => 'ShouCangTianXiaSD_800', //收藏天下
   'sctx2' => 'ShouCangTianXiaHD_2000', //收藏天下2
   'zhms' => 'ZhongHuaMeiShiSD_800', //中华美食
   'zhms2' => 'ZhongHuaMeiShiHD_2000', //中华美食2
   //安徽
   'jjgw' => 'JiaJiaGouWuSD_800', //家家购物
   'jjgw2' => 'JiaJiaGouWuHD_2000', //家家购物2
   //湖南
   'cpd' => 'ChaPinDaoSD_800', //茶频道
   'cpd2' => 'ChaPinDaoHD_2000', //茶频道2
   'jykt' => 'JYKatonSD_800', //金鹰卡通
   'jykt2' => 'JYKatonHD_2000', //金鹰卡通2
   //江西
   'fsgw' => 'FengShangGouWuSD_800', //风尚购物
   'fsgw2' => 'FengShangGouWuHD_2000', //风尚购物2
   //江苏
   'cftx' => 'CaiFuTianXiaSD_800', //财富天下
   'cftx2' => 'CaiFuTianXiaHD_2000', //财富天下2
   'hxgw' => 'HaoXiangGouWuSD_800', //好享购物
   'hxgw2' => 'HaoXiangGouWuHD_2000', //好享购物2
   //贵州
   'tywq' => 'TianYuanWeiQiSD_800', //天元围棋
   'tywq2' => 'TianYuanWeiQiHD_2000', //天元围棋2
   //空中课堂
   'kzktx1' => 'KZKT-Xiao1SD_800', //空中课堂一年级
   'kzktx1b' => 'KZKT-Xiao1HD_2000', //空中课堂一年级2
   'kzktx2' => 'KZKT-Xiao2SD_800', //空中课堂二年级
   'kzktx2b' => 'KZKT-Xiao2HD_2000', //空中课堂二年级2
   'kzktx3' => 'KZKT-Xiao3SD_800', //空中课堂三年级
   'kzktx3b' => 'KZKT-Xiao3HD_2000', //空中课堂三年级2
   'kzktx4' => 'KZKT-Xiao4SD_800', //空中课堂四年级
   'kzktx4b' => 'KZKT-Xiao4HD_2000', //空中课堂四年级2
   'kzktx5' => 'KZKT-Xiao5SD_800', //空中课堂五年级
   'kzktx5b' => 'KZKT-Xiao5HD_2000', //空中课堂五年级2
   'kzktx6' => 'KZKT-Xiao6SD_800', //空中课堂六年级
   'kzktx6b' => 'KZKT-Xiao6HD_2000', //空中课堂六年级2
   'kzktc1' => 'KZKT-Chu1SD_800', //空中课堂初一
   'kzktc1b' => 'KZKT-Chu1HD_2000', //空中课堂初一2
   'kzktc2' => 'KZKT-Chu2SD_800', //空中课堂初二
   'kzktc2b' => 'KZKT-Chu2HD_2000', //空中课堂初二2
   'kzktc3' => 'KZKT-Chu3SD_800', //空中课堂初三
   'kzktc3b' => 'KZKT-Chu3HD_2000', //空中课堂初三2
   'kzktg1' => 'KZKT-Gao1SD_800', //空中课堂高一
   'kzktg1b' => 'KZKT-Gao1HD_2000', //空中课堂高一2
   'kzktg2' => 'KZKT-Gao2SD_800', //空中课堂高二
   'kzktg2b' => 'KZKT-Gao2HD_2000', //空中课堂高二2
   'kzktg3' => 'KZKT-Gao3SD_800', //空中课堂高三
   'kzktg3b' => 'KZKT-Gao3HD_2000', //空中课堂高三2
   ];

$array = explode("_", $n[$id]);
$stream = "http://yfsv.vsd.gehua.net.cn/live/ipcdn,{$array[0]}_{$array[1]}K/";
$timestamp = intval((time()-60)/6);
$current = "#EXTM3U"."\r\n";
$current.= "#EXT-X-VERSION:3"."\r\n";
$current.= "#EXT-X-TARGETDURATION:6"."\r\n";
$current.= "#EXT-X-MEDIA-SEQUENCE:{$timestamp}"."\r\n";
for ($i=0; $i<6; $i++) {
    $current.= "#EXTINF:6000,"."\r\n";
    $current.= $stream.rtrim(chunk_split($timestamp, 3, "/"), "/").".ts"."\r\n";
    $timestamp = $timestamp + 1;
    }
echo $current;
?>
